home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM 1995 Fall / PD-ROM F95.toast / Telecom / Internet / Internet A-M / MacHTTP 1.2.3 ƒ / search.script < prev   
Encoding:
Text File  |  1993-12-08  |  1.1 KB  |  20 lines  |  [TEXT/ttxt]

  1. -- This script demonstrates accessing searchable files from MacHTTP.
  2. -- (What it really shows is how to pass arguments to AppleScripts.)
  3. -- http_search_args is a predefined variable that is passed from the server
  4. --  to the script and contains the user-supplied arguments. If the arguments
  5. --  are empty, the script asks the WWW client to prompt for them. 
  6. --  If arguments were passed, then the script behaves accordingly.
  7. --  Note: the <ISINDEX> HTML tag is what tells the client the document is searchable
  8. --    and arguments should be collected and passed. 
  9.  
  10. --set http_10_header to "HTTP/1.0 200 OK" & return & "Server: MacHTTP 1.2" & return & ¬
  11. --    "MIME-version: 1.0" & return & "Content-type: text/html" & return
  12. set http_10_header to ""
  13. if http_search_args = "" then
  14.     return http_10_header & "<ISINDEX><h2>Please enter the keyword to search for.</h2>"
  15. else if http_search_args = "hello" then
  16.     return http_10_header & "<h2>Hello, how are you?</h2>"
  17. else
  18.     return http_10_header & "<h2>Sorry, I don't understand '" & ¬
  19.         http_search_args & "'. Try 'hello' instead.</h2>"
  20. end if